package cn.kxm.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.kxm.dao.PartMapper;
import cn.kxm.pojo.Part;
import cn.kxm.pojo.PartType;
import cn.kxm.service.PartService;
@Service
public class PartServiceImpl implements PartService{
    @Autowired
	private PartMapper partMapper;
	
	
	@Override
	public List<Map<String, Object>> getPartListByCodes(String[] codes) {
		List<Map<String, Object>> maps=partMapper.getPartListByCodes(codes);
		Integer a=1;
		Float p=new Float(0.00);
		for (Map<String, Object> map : maps) {
			map.put("amount", a);
			map.put("price", p);
		}
		return maps;
	}


	@Override
	public List<Map<String, Object>> getPartList(String customName,Integer page,
    		Integer size,String size2,String partNo,String name,Integer type) {
		Integer currPage=(page-1)*size;
		return partMapper.getPartList(customName, currPage, size, size2, partNo, name, type);
	}


	@Override
	public int getPartListCount(String size2,String partNo,String name,Integer type) {
		return partMapper.getPartListCount(size2, partNo, name, type);
	}

	@Override
	public List<Map<String, Object>> getPartListt(Part part, Integer currentPageNo,Integer pageSize) {
		return partMapper.getPartListt(part, (currentPageNo-1)*pageSize, pageSize);
	}
	@Override
	public int getPartCount(Part part) {
		return partMapper.getPartCount(part);
	}
	@Override
	public List<Map<String, Object>> getByCode(String code) {
		return partMapper.getByCode(code);
	}
	@Override
	public List<Map<String, Object>> getPart_ib(String code) {
		return partMapper.getPart_ib(code);
	}


public List<Part> getPartList(String partBrand, String partNo,
			String partName, Integer partTypeId, Integer pageNo,
			Integer pageSize) {
		return partMapper.getPartList(partBrand, partNo, partName, partTypeId, pageNo, pageSize);
	}

	@Override
	public int getPartCount(String partBrand, String partNo, String partName,
			Integer partTypeId) {
		return partMapper.getPartCount(partBrand, partNo, partName, partTypeId);
	}

	@Override
	public List<PartType> getPartTypeList() {
		return partMapper.getPartTypeList();
}
